package o;

import android.annotation.TargetApi;
import android.app.Activity;
import android.os.Bundle;
import androidx.annotation.NonNull;
import o.dky.j;

public class eqf extends dxx implements ceh {
    protected NetWorkUtls ˋ;
    private boolean ˎ = false;

    public eqf(@NonNull Activity activity) {
        this.targetActivity = activity;
    }

    public String getName() {
        return "PhoneStatePermissionChecker";
    }

    public void onSaveInstanceState(Bundle bundle) {
        if (this.ˋ == null || !this.ˋ.isShowing()) {
            bundle.putBoolean("permission_dialog_state", false);
        } else {
            bundle.putBoolean("permission_dialog_state", true);
        }
    }

    public void restoreSavedInstanceState(Bundle bundle) {
        this.ˎ = bundle.getBoolean("permission_dialog_state");
    }

    public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
        if (14 == i) {
            PermissionChecker.ˎ(this, i, strArr, iArr);
        }
    }

    public void onDestroy() {
        if (this.ˋ != null) {
            this.ˋ.dismiss();
        }
    }

    public void doCheck() {
        if (!eqe.ˎ(this.targetActivity)) {
            checkSuccess();
        } else if (this.ˎ) {
            ˊ();
        } else if (!PermissionChecker.ˋ(this.targetActivity, 14)) {
            checkSuccess();
        } else if (this.ˋ != null) {
            this.ˋ.dismiss();
        }
    }

    public void ˏ(int i, int i2) {
        if (i2 == 0) {
            checkSuccess();
        } else {
            ˊ();
        }
    }

    @TargetApi(24)
    private void ˊ() {
        boolean shouldShowRequestPermissionRationale = this.targetActivity.shouldShowRequestPermissionRationale("android.permission.READ_PHONE_STATE");
        if (this.ˋ == null) {
            this.ˋ = new NetWorkUtls();
        }
        this.ˋ.showDial(this.targetActivity, shouldShowRequestPermissionRationale, j.ᐨ, 14);
    }
}
